{% sql %}
    SELECT TOP 1 a.SearchValue
      FROM Attendance as a
     WHERE a.PersonAliasId = {{ primaryaliasid }}
     ORDER BY a.CreatedDateTime DESC
{% endsql %}

{% if results[0].SearchValue %}
    {{- 0 -}}
{% else %}
    {{- 1 -}}
{% endif %}